cmake_minimum_required(VERSION 2.8)

SET(CMAKE_MYLIBRARIES_DIR "${CMAKE_SOURCE_DIR}/libraries")
SET(CMAKE_MYANN_DIR        "${CMAKE_MYLIBRARIES_DIR}/ann_1.1.2")
SET(CMAKE_MYGSL_DIR        "${CMAKE_MYLIBRARIES_DIR}/gsl_1.16")
SET(CMAKE_MYLAPACK_DIR     "${CMAKE_MYLIBRARIES_DIR}/lapack_3.5.0")


option(COMPILIMG_MODE_DEBUG   "debug mode with ON=-O0 OFF=-O3" ON)
SET(CMAKE_C_COMPILER   "/usr/local/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/local/bin/g++")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fopenmp -DMY_OPENMP -O3")
##if(COMPILIMG_MODE_DEBUG)
##  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fopenmp -O0") 
##else(COMPILIMG_MODE_DEBUG)
##  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fopenmp -O3")
##endif(COMPILIMG_MODE_DEBUG)


project(MyDG2D)
file(GLOB_RECURSE source_files sources/*)
add_executable(runDG2D ${source_files})

include_directories(${CMAKE_MYANN_DIR}/include)
include_directories(${CMAKE_MYGSL_DIR}/include)
include_directories(${CMAKE_MYLAPACK_DIR}/SRC)

add_library(mylibann      STATIC IMPORTED)
add_library(mylibgsl      STATIC IMPORTED)
add_library(mylibgslcblas STATIC IMPORTED)
add_library(myliblapack   STATIC IMPORTED)
add_library(mylibblas     STATIC IMPORTED)

set_target_properties(mylibann      PROPERTIES IMPORTED_LOCATION ${CMAKE_MYANN_DIR}/lib/libANN.a)
set_target_properties(mylibgsl      PROPERTIES IMPORTED_LOCATION ${CMAKE_MYGSL_DIR}/lib/libgsl.a)
set_target_properties(mylibgslcblas PROPERTIES IMPORTED_LOCATION ${CMAKE_MYGSL_DIR}/lib/libgslcblas.a)
set_target_properties(myliblapack   PROPERTIES IMPORTED_LOCATION ${CMAKE_MYLAPACK_DIR}/lib/liblapack.a)
set_target_properties(mylibblas     PROPERTIES IMPORTED_LOCATION ${CMAKE_MYLAPACK_DIR}/lib/libblas.a)

message("directory of lib Ann    --> ${CMAKE_MYANN_DIR}/lib")
message("directory of lib gsl    --> ${CMAKE_MYGSL_DIR}/lib")
message("directory of lib lapack --> ${CMAKE_MYLAPACK_DIR}/lib")

target_link_libraries(runDG2D mylibgsl mylibgslcblas myliblapack mylibblas mylibann)

